<?php
/**
 * Created by PhpStorm.
 * Author: 芸签cms www.yunqiancms.com
 * User: sun
 * Date: 2022/6/27
 * Time: 4:49 PM
 */
namespace app\backend\modules\sys\services;

use app\common\models\Role;
use app\common\models\AdminUser;


class RoleService
{
    public function getList($params){
        $query = Role::site()->select();
        if($params['name']){
            $query->where('name','like','%'.$params['name'].'%');
        }
        /*if ($params['status']) {
            $query = $query->where('status', $params['status']);
        }*/


        $uids = AdminUser::pluck('uid')->toArray();

        $list = $query->with(['roleUser'=>function($q) use ($uids){
                $q->whereNotIn('user_id',$uids);
            }])->paginate(10);
        return $list;
    }
}